<?php

//echo file_put_contents("test.txt","Hello World. Testing!".time());

$callback = $_REQUEST['callback'];

// Create the output object.
$output = array(array('score' => '100', 'askid' => 'Banana'),array('score' => '200', 'askid' => 'Banana'));

header("Access-Control-Allow-Origin:*");
header("Access-Control-Allow-Credentials:true");
header("Access-Control-Allow-Headers:Content-Type,Accept,X-Requested-With");
header("Access-Control-Allow-Methods:GET,POST");

//start output
if ($callback) {
    header('Content-Type: text/javascript');
    echo $callback . '(' . json_encode($output) . ');';
} else {
    header('Content-Type: application/x-json');
    echo json_encode($output);
}


// 'Access-Control-Allow-Origin' *;
// 'Access-Control-Allow-Credentials' 'true';
// 'Access-Control-Allow-Headers' 'Content-Type,Accept,X-Requested-With';
// 'Access-Control-Allow-Methods' 'GET, POST';
?>